import request from '@/utils/request'

// 查询项目列表
export function listItem(params) {
  return request({
    url: '/system/item/list',
    method: 'get',
    params: params
  })
}

// 查询项目详细
export function getItem(id) {
  return request({
    url: '/system/item/' + id,
    method: 'get'
  })
}

// 新增项目
export function addItem(data) {
  return request({
    url: '/system/item',
    method: 'post',
    data: data
  })
}

// 修改项目
export function updateItem(data) {
  return request({
    url: '/system/item',
    method: 'put',
    data: data
  })
}

// 删除项目
export function delItem(id) {
  return request({
    url: '/system/item/' + id,
    method: 'delete'
  })
}

// 分配项目给医院
export function assignItemToHospital(data) {
  return request({
    url: '/system/item/assignHospital',
    method: 'post',
    data: data
  })
}

// 获取项目的医院分配情况
export function getItemHospitalAssignments(id) {
  return request({
    url: '/system/item/getItemHospitalAssignments/' + id,
    method: 'get'
  })
}

// 移除项目医院分配
export function removeItemHospitalAssignment(itemId, hospitalId) {
  return request({
    url: '/system/item/removeItemHospitalAssignment/' + itemId + '/' + hospitalId,
    method: 'delete',
  })
}